#ifndef __TCPCLIENT_H__
#define __TCPCLIENT_H__

#include "Socket.h"
#include "Epoll.h"
#include "InetAddress.h"
#include <unordered_map>
using std::unordered_map;

class TcpConnection;

class TcpClient
{
public:
    TcpClient(string ip, int port);

    void start();

    void connect();

private:
    void OnConnectionCb(shared_ptr<TcpConnection> &pconn);
	void OnMessageCb(shared_ptr<TcpConnection> &pconn);
	void OnCloseCb(shared_ptr<TcpConnection> &pconn);

    void OnEINPROGRESS(shared_ptr<TcpConnection> &pconn);

private:
    InetAddress addr_;
    Epoll epoll_;
    unordered_map<int, shared_ptr<TcpConnection>> map_;
    unordered_map<int, shared_ptr<Socket>> socks_;
};

#endif
